Belgelerim/ceng_491/implementation/doxygen/TraffEdu_Developers_Manual_Reference_ToSource/TraffEdu.cpp

Go to the documentation of this file.
00001 // TraffEdu.cpp : Defines the class behaviors for the application.
00002 //
00003 
00004 #include "stdafx.h"
00005 #include "TraffEdu.h"
00006 #include "MainFrm.h"
00007 
00008 #include "TraffEduDoc.h"
00009 #include "TraffEduView.h"
00010 
00011 #ifdef _DEBUG
00012 #define new DEBUG_NEW
00013 #endif
00014 
00015 
00016 // CTraffEduApp
00017 
00018 BEGIN_MESSAGE_MAP(CTraffEduApp, CWinApp)
00019         ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
00020         // Standard file based document commands
00021         ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
00022         ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
00023         // Standard print setup command
00024         ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
00025         
00026         // Undo, Redo Operations
00027         
00028 END_MESSAGE_MAP()
00029 
00030 
00031 // CTraffEduApp construction
00032 
00033 CTraffEduApp::CTraffEduApp()
00034 {
00035 }
00036 
00037 
00038 // The one and only CTraffEduApp object
00039 
00040 CTraffEduApp theApp;
00041 
00042 // CTraffEduApp initialization
00043 
00044 BOOL CTraffEduApp::InitInstance()
00045 {
00046         // InitCommonControls() is required on Windows XP if an application
00047         // manifest specifies use of ComCtl32.dll version 6 or later to enable
00048         // visual styles.  Otherwise, any window creation will fail.
00049         InitCommonControls();
00050 
00051         CWinApp::InitInstance();
00052 
00053         // Initialize OLE libraries
00054         if (!AfxOleInit())
00055         {
00056                 AfxMessageBox(IDP_OLE_INIT_FAILED);
00057                 return FALSE;
00058         }
00059         AfxEnableControlContainer();
00060         SetRegistryKey(_T("Local AppWizard-Generated Applications"));
00061         LoadStdProfileSettings(4);  
00062         CSingleDocTemplate* pDocTemplate;
00063         pDocTemplate = new CSingleDocTemplate(
00064                 IDR_MAINFRAME,
00065                 RUNTIME_CLASS(CTraffEduDoc),
00066                 RUNTIME_CLASS(CMainFrame),       // main SDI frame window
00067                 RUNTIME_CLASS(CTraffEduView));
00068         if (!pDocTemplate)
00069                 return FALSE;
00070         AddDocTemplate(pDocTemplate);
00071         // Parse command line for standard shell commands, DDE, file open
00072         CCommandLineInfo cmdInfo;
00073         ParseCommandLine(cmdInfo);
00074         // Dispatch commands specified on the command line.  Will return FALSE if
00075         // app was launched with /RegServer, /Register, /Unregserver or /Unregister.
00076         if (!ProcessShellCommand(cmdInfo))
00077                 return FALSE;
00078         // The one and only window has been initialized, so show and update it
00079         m_pMainWnd->ShowWindow(SW_SHOW);
00080         m_pMainWnd->UpdateWindow();
00081         // call DragAcceptFiles only if there's a suffix
00082         //  In an SDI app, this should occur after ProcessShellCommand
00083         return TRUE;
00084 }
00085 
00086 
00087 
00088 // CAboutDlg dialog used for App About
00089 
00090 class CAboutDlg : public CDialog
00091 {
00092 public:
00093         CAboutDlg();
00094 
00095 // Dialog Data
00096         enum { IDD = IDD_ABOUTBOX };
00097 
00098 protected:
00099         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00100 
00101 // Implementation
00102 protected:
00103         DECLARE_MESSAGE_MAP()
00104 public:
00105         afx_msg void OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/);
00106 };
00107 
00108 CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
00109 {
00110 }
00111 
00112 void CAboutDlg::DoDataExchange(CDataExchange* pDX)
00113 {
00114         CDialog::DoDataExchange(pDX);
00115 }
00116 
00117 BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
00118         ON_WM_CONTEXTMENU()
00119 END_MESSAGE_MAP()
00120 
00121 // App command to run the dialog
00122 void CTraffEduApp::OnAppAbout()
00123 {
00124         CAboutDlg aboutDlg;
00125         aboutDlg.DoModal();
00126 }
00127 
00128 BOOL CTraffEduApp::OnIdle(LONG lCount)
00129 {
00130         BOOL continue_processing = CWinApp::OnIdle(lCount);
00131         CMainFrame* pFrame = dynamic_cast<CMainFrame*> (m_pMainWnd);
00132         if (pFrame)
00133         {
00134                 if ( pFrame->DoChildIdleProc() )
00135                         return TRUE;
00136         }
00137         return continue_processing;
00138 }
00139 
00140 
00141 // CTraffEduApp message handlers
00142 
00143 
00144 void CAboutDlg::OnContextMenu(CWnd* pWnd, CPoint point)
00145 {
00146         
00147 }

Generated on Sun May 28 18:54:09 2006 for TraffEdu by  doxygen 1.4.6-NO